from pip._internal import index

from pcU import *
import time

url="http://www.dili360.com"
s=pcScrawler()
for page in range(1,11):
    url="http://www.dili360.com".format(page)
    titles=s.getTexts(url,selector="ul > li.active > h3")
    #print(titles,len(titles))
    newurls=s.getUrl(url,selector="ul > li > a")
    print(newurls)
    contents = s.getTexts(newurls, selector="ul > li")
    print("MISSION")
    with open("第{}页".format(page) + "第{}条.txt".format(index), 'w+') as f:
        f.write(str(contents))

#HomeSlider > div > div:nth-child(2) > a
#简介 intro=s.getTexts(url,selector="")
#发布单位 org=s.getTexts(url,selector="")
#时间 data=s.getTexts(url,selector="")
# with open ("result.txt",'w+') as f:
#     f.write("".format(page)+str(titles))
# print("第{}页已全部搞定!".format(page))
time.sleep(1)